<?PHP
require_once("../settings.php");
require_once("../connect.php");
require_once("../functions.php");

foreach ($settings['divisions'] as $division) {
$data['accountKey'] = $division;

# Run Corp Transactions XML and insert into database
	if ($settings['corptransactions'] == true) {
$url = "http://api.eve-online.com/corp/WalletTransactions.xml.aspx";
get_api($url);
	$xml = simplexml_load_file($xmlfile);
	unlink($xmlfile);
	if ($xml->error) {
		echo $xml->error[code].'<br />';
		log_error(array($info,$xml->error));
	}
	else {
		foreach ($xml->result->rowset->row as $row) {
		$query6 = "
INSERT IGNORE INTO `wcorp` (`transactionDateTime`,`transactionID`,`quantity`,`typeName`,`typeID`,`price`,`clientID`,`clientName`,`characterID`,`characterName`,`stationID`,`stationName`,`transactionType`,`division`) VALUES ('".mysql_real_escape_string($row['transactionDateTime'])."','".mysql_real_escape_string($row['transactionID'])."','".mysql_real_escape_string($row['quantity'])."','".mysql_real_escape_string($row['typeName'])."','".mysql_real_escape_string($row['typeID'])."','".mysql_real_escape_string($row['price'])."','".mysql_real_escape_string($row['clientID'])."','".mysql_real_escape_string($row['clientName'])."','".mysql_real_escape_string($row['characterID'])."','".mysql_real_escape_string($row['characterName'])."','".mysql_real_escape_string($row['stationID'])."','".mysql_real_escape_string($row['stationName'])."','".mysql_real_escape_string($row['transactionType'])."','".mysql_real_escape_string($division)."')";
		$result = $db->query($query6);
		}
	}
	} # End Corp Transactions XML

}

?>